// 引入 request 文件
import request from './index.js'

// // 分页查询学习列表
// export const pageStudyInfo = (params) => {
// 	return request({
// 		url: '/study/studyInfo/page',
// 		method: 'get',
// 		data: params,
//         header: {} // 自定义
// 	})
// }
// // 获取学习列表详细信息
// export const studyInfoById = (id) => {
// 	return request({
// 		url: `/study/studyInfo/${id}`,
// 		method: 'get',
// 	})
// }
//登录
export const login = (params) => {
	return request({
		url: '/driver-service/driver/login?key=' + params.key + '&code=' + params.code,
		method: 'post',
		data: {
			driverAcc: params.acc,
			password: params.pwd
		}
	})
}
//注册
export const register = (params) => {
	return request({
		url: '/driver-service/driver/register',
		method: 'post',
		data: params
	})
}
//获取验证码
export const getCode = (key) => {
	return request({
		url: '/driver-service/driver/getCode',
		method: 'get',
		data: {
			key: key
		}
	})
}
//上传身份证图片
export const uploadImg = (params) => {
	return request({
		url: '/upload-service/recognition/uploadIdNum',
		method: 'post',
		data: params
	})
}
//上传驾驶证图片
export const uploadDriverImg = (params) => {
	return request({
		url: '/upload-service/recognition/uploadDrivingLicenseImg',
		method: 'post',
		data: params
	})
}

//司机查看订单列表
export const getOrderList = (id) => {
	return request({
		url: '/order-service/order/orderList',
		method: 'get',
		data: {
			driverId: id
		}
	})
}
//司机抢单
export const orderTaking = (data) => {
	return request({
		url: '/order-service/order/orderTaking',
		method: 'post',
		data: data
	})
}
//生成短信验证
export const sms = (phone) => {
	return request({
		url: '/driver-service/driver/getPhoneCode',
		method: 'get',
		data: {
			phone: phone
		}
	})
}
//短信验证登录
export const phoneLogin = (phone,code) => {
	return request({
		url: '/driver-service/driver/phoneLogin',
		method: 'get',
		data: {
			phone: phone,
			code:code
		}
	})
}
//接乘客获得订单信息
export const getOrder = (id) => {
	return request({
		url: '/order-service/order/confirmStart',
		method: 'get',
		data: {
			driverId: id
		}
	})
}
//开始和结束接单
export const driverStatus = (data) => {
	return request({
		url: '/driver-service/driver/driverStatus',
		method: 'post',
		data: data
	})
}

//查询系统派单
export const getDriverOrders = (driverId) => {
	return request({
		url: '/driver-service/driver/getDriverOrders',
		method: 'get',
		data: {
			driverId: driverId
		}
	})
}
